//
//  Queue+.swift
//  HoneyChat
//
//  Created by hccc on 2023/3/27.
//

import Foundation

public enum QueueCommon {
    static func async(_ work: @escaping () -> Void) {
        DispatchQueue.global().async {
            work()
        }
    }

    static func async(deadline: DispatchTime, _ work: @escaping () -> Void) {
        DispatchQueue.global().asyncAfter(deadline: deadline) {
            work()
        }
    }
}

public enum QueueMain {
    static func once(key: String, _ work: @escaping () -> Void) {
        DispatchQueue.once(key: key, block: work)
    }

    static func async(_ work: @escaping () -> Void) {
        DispatchQueue.main.async {
            work()
        }
    }

    static func async(deadline: DispatchTime, _ work: @escaping () -> Void) {
        DispatchQueue.main.asyncAfter(deadline: deadline) {
            work()
        }
    }
}
